import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace DingdAttendanceCheckRecordApi {
  /** 员工打卡记录信息 */
  export interface DingdAttendanceCheckRecord {
    id: number; // 编号
    userId?: string; // userid
    address: string; // 打卡地点
    corpId: string; // 公司Id
    checkTime?: number; // 打卡时间
    locationResult: string; // 打卡结果
    groupId: string; // 分组Id
    latitude: number; // 纬度
    bizId: string; // 业务Id
    locationMethod: string; // 打卡方式
    deviceSN: string; // 设备编码
    checkByUser: number; // 是否员工打卡
    longitude: number; // 经度
  }
}

/** 查询员工打卡记录分页 */
export function getDingdAttendanceCheckRecordPage(params: PageParam) {
  return requestClient.get<PageResult<DingdAttendanceCheckRecordApi.DingdAttendanceCheckRecord>>('/moxi/dingd-attendance-check-record/page', { params });
}

/** 查询员工打卡记录详情 */
export function getDingdAttendanceCheckRecord(id: number) {
  return requestClient.get<DingdAttendanceCheckRecordApi.DingdAttendanceCheckRecord>(`/moxi/dingd-attendance-check-record/get?id=${id}`);
}

/** 新增员工打卡记录 */
export function createDingdAttendanceCheckRecord(data: DingdAttendanceCheckRecordApi.DingdAttendanceCheckRecord) {
  return requestClient.post('/moxi/dingd-attendance-check-record/create', data);
}

/** 修改员工打卡记录 */
export function updateDingdAttendanceCheckRecord(data: DingdAttendanceCheckRecordApi.DingdAttendanceCheckRecord) {
  return requestClient.put('/moxi/dingd-attendance-check-record/update', data);
}

/** 删除员工打卡记录 */
export function deleteDingdAttendanceCheckRecord(id: number) {
  return requestClient.delete(`/moxi/dingd-attendance-check-record/delete?id=${id}`);
}

/** 批量删除员工打卡记录 */
export function deleteDingdAttendanceCheckRecordList(ids: number[]) {
  return requestClient.delete(`/moxi/dingd-attendance-check-record/delete-list?ids=${ids.join(',')}`)
}

/** 导出员工打卡记录 */
export function exportDingdAttendanceCheckRecord(params: any) {
  return requestClient.download('/moxi/dingd-attendance-check-record/export-excel', params);
}

